package org.zjt.config;

import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * DESC
 *
 * @author
 * @create 2017-04-15 上午9:34
 **/
@Order(Ordered.HIGHEST_PRECEDENCE + 20)
public class RpcRoleConditional extends SpringBootCondition{
    public RpcRoleConditional() {
        super();
    }

    @Override
    public ConditionOutcome getMatchOutcome(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        if (System.getProperty("rpc_customer") != null && System.getProperty("rpc_customer").equals("1"))
        return ConditionOutcome.noMatch("the concurrent project not is rpc server ");
        return ConditionOutcome.match();
    }
}
